#include <stdio.h>
#include <string.h>

const int MaxNameLength=250;
const int MaxSayLen=250;
const int MaxWordNum=20;
const int WeekNum=7;

// int indexof(char* c1,char* c2)
// {
//     char* rp=strstr(c1, c2);

//     if(rp==NULL)
//     {
//         return -1;
//     }
//     else{
//         return (int)(rp-c1);
//     }
// }



void printArray(int** priceArray,int len,int len2)
{
    for(int i=0;i<len;i++)
    {
        for(int j=0;j<len2;j++)
        {
            printf("%d\t",priceArray[i][j]);
        }
        printf("\n");
    }
    printf("\n");

}

void printArray2(int* priceArray,int len)
{
    for(int i=0;i<len;i++)
    {
        printf("%d\t",priceArray[i]);
    }
    printf("\n");

}

//寻找姓名
int findName(char** name,int len,char* find)
{
    for(int i=0;i<len;i++)
    {
        if(strcmp(name[i],find)==0)
        {
            return i;
        }
    }
    return -1;
}



int main(){
    int m,n,p;

    int i,j;
    scanf("%d %d %d",&m,&n,&p);
    char** name=new char*[m];

    for(i=0;i<m;i++)
    {
        name[i]=new char[MaxNameLength];
        scanf("%s",name[i]);
    }

    int** says=new int*[p];
    int wordnum;
    int wordlen;
    char temp[MaxWordNum][MaxSayLen];

    char ch='\n';

    char guilty[10]="guilty";
    char today[6]="Today";
    char I[10]="am";
    char week[WeekNum][12]={"monday","tuesday","wednesday","thursday","friday","saturday","sunday"};

    int len=0;
    for(i=0;i<p;i++)
    {
        wordnum=0;
        wordlen=0;
        
        // printf("%d\n",ch);
        while (ch=='\n'||ch==EOF||ch=='\r')
        {
            ch=getchar();
        }
        // printf("%d\n",ch);
        
        while (ch!='\n'&&ch!=EOF&&ch!='\r'){
            if(ch==' ')
            {
                temp[wordnum][wordlen]='\0';
                wordlen=0;
                wordnum++;
            }
            else if((ch>='A'&&ch<='Z')||(ch>='a'&&ch<='z')){
                temp[wordnum][wordlen]=ch;
                wordlen++;
            }
            ch=getchar();
        } 


        temp[wordnum][wordlen]='\0';
        for(j=0;j<wordlen;j++)
        {
            char c=temp[wordnum][j];
            if(c>='A'&&c<='Z')
            {
                temp[wordnum][j]=c-'A'+'a';
            }
        }
        wordlen=0;
        wordnum++;

        // printf("%d %d %s\n",i,wordnum,temp[wordnum-1]);

        if(strcmp(temp[wordnum-1],guilty)==0)
        {
            int sayIndex=findName(name,m,temp[0]);
            int mbIndex;
            if(sayIndex>=0)
            {
                says[len]=new int[3];
                if(strcmp(temp[2],I)==0)
                {
                    mbIndex=sayIndex;
                }
                else{
                    mbIndex=findName(name,m,temp[1]);
                }
                if(mbIndex>=0)
                {
                    says[len][0]=sayIndex;
                    says[len][1]=mbIndex;
                    if(wordnum>4)
                    {
                        says[len][2]=0;
                    }
                    else{
                        says[len][2]=1;
                    }
                    len++;
                }
               
            }
        }
        else if(strcmp(temp[1],today)==0)
        {
            int sayIndex=findName(name,m,temp[0]);
            if(sayIndex>=0)
            {
                says[len]=new int[3];
                int mbIndex=-1;
                for(j=0;j<WeekNum;j++)
                {
                    // printf("%s %s\n",temp[wordnum-1],week[j]);
                    if(strcmp(temp[wordnum-1],week[j])==0)
                    {
                        mbIndex=j;
                        break;
                    }
                }
                if(mbIndex>=0)
                {
                    says[len][0]=sayIndex;
                    says[len][1]=-1;
                    says[len][2]=mbIndex;
                    len++;
                }
            }
        }
    }

    // printArray(says,len,3);

    // printArray(says,len,3);
    //0代表说假话 1代表说真话
    int* status=new int[m];
    //说假话的人的序号
    int* search=new int[n];
    //每次搜索检查的结果 -1代表未涉及 1代表犯人 0代表不是
    int* result=new int[m];
    //星期的状态
    int* weekResult=new int[WeekNum];

    //大于0代表 谁是罪犯 -1代表矛盾 -2代表不确定
    int flag=-1;

    search[0]=0;
    i=0;
    int maxHead=m-n;
    while (search[0]<=maxHead)
    {
        if(i<n-1)
        {
            search[i+1]=search[i]+1;
            i++;
        }
        else 
        {
            for(j=0;j<m;j++)
            {
                status[j]=1;
                result[j]=-1;
            }
            for(j=0;j<n;j++)
            {
                status[search[j]]=0;
            }

            for(j=0;j<WeekNum;j++)
            {
                weekResult[j]=-1;
            }

            // printArray2(search,n);

             //大于0代表 谁是罪犯 -1代表矛盾 -2代表不确定
            int temp_flag=-2;
            for(j=0;j<len;j++)
            {
                if(says[j][1]>=0)
                {
                    int temp_status=says[j][2]==status[says[j][0]];
                    int index=says[j][1];
                    int now_status=result[index];
                    if(now_status==-1)
                    {
                        result[index]=temp_status;
                    }
                    //矛盾代表本次搜索无效
                    else if(temp_status!=now_status)
                    {
                        temp_flag=-1;
                        break;
                    }
                }
                else{
                    int index=says[j][0];
                    int temp_status=status[index];
                    int weekIndex=says[j][2];
                    int now_status=weekResult[weekIndex];
                    if(now_status==-1)
                    {
                        weekResult[weekIndex]=temp_status;
                    }
                    else if(temp_status!=now_status)
                    {
                        temp_flag=-1;
                        break;
                    }
                }
                
            }

            // printArray2(weekResult,WeekNum);

            //检查星期的判断逻辑
            if(temp_flag!=-1)
            {
                //是星期几的个数
                int count=0;
                //不是星期几的个数
                int count1=0;
                for(j=0;j<WeekNum;j++)
                {
                    if(weekResult[j]==1)
                    {
                        count++;
                    }
                    else if(weekResult[j]==0)
                    {
                        count1++;
                    }
                }
                if(count>1||count1>=WeekNum)
                {
                    temp_flag=-1;
                }
            }
            
            //检查罪犯的判断
            if(temp_flag!=-1)
            {
                //罪犯的数目
                int count1=0;
                //最后一个罪犯的位置
                int index1=-1;
                //不确定人的数目
                int count2=0;
                //最后一个不确定人的位置
                int index2=-1;

                for(j=0;j<m;j++)
                {
                    if(result[j]==1)
                    {
                        count1++;
                        index1=j;
                    }
                    else if(result[j]==-1)
                    {
                        count2++;
                        index2=j;
                    }
                }

                if(count1>1)
                {
                    temp_flag=-1;
                }
                else if(count1==1)
                {
                    temp_flag=index1;
                }
                else if(count2>1)
                {
                    temp_flag=-2;
                }
                else if(count2==1)
                {
                    temp_flag=index2;
                }

                if(temp_flag>=0)
                {
                    if(flag<0)
                    {
                        flag=temp_flag;
                    }
                    //有多种是罪犯的情况
                    else if(flag!=temp_flag)
                    {
                        flag=-2;
                        // printf("temp_flag:%d\n",temp_flag);
                        break;
                    }
                }
                else{
                    if(flag<0)
                        flag=temp_flag;
                }
            }
            // printf("temp_flag:%d\n",temp_flag);

            search[i]++;
            while (search[i]>m-n+i)
            {
                if(i==0)
                {
                    break;
                }
                i--;
                search[i]++;
               
            }
            
        }
    }

    if(flag==-1)
    {
        printf("Impossible\n");
    }
    else if(flag==-2)
    {
        printf("Cannot Determine\n");
    }
    else{
        printf("%s\n",name[flag]);
    }

    for(i=0;i<m;i++)
    {
        delete name[i];
    }
    delete name;

    for(i=0;i<len;i++)
    {
        delete says[i];
    }
    delete says;

    delete status;
    delete search;
    delete result;
    return 0;
}